package com.example;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MainApp {
    public static void main(String[] args) {
        // 加载Spring配置文件，初始化IOC容器
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        
        // 从容器中获取Product对象
        Product product = (Product) context.getBean("product");
        System.out.println("从Spring容器中获取的Product对象:");
        System.out.println(product);
        
        // 从容器中获取Student对象
        Student student = (Student) context.getBean("student");
        System.out.println("\n从Spring容器中获取的Student对象:");
        System.out.println(student);
    }
}
    